<?php

namespace common\validate;

class EpisodeAllocation extends BaseValidate
{
    // 验证规则
    protected $rule = [];

    // Fields 验证场景定义
    public function sceneFields()
    {
        return $this;
    }

    // Find 验证场景定义
    public function sceneFind()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array');
    }

    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this->append('data', 'require|array')
            ->append('data.entity_id', 'require|integer')
            ->append('data.user_id', 'require|integer')
            ->append('data.role_code', 'require');
    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data', 'require|array');
    }

    // Delete 验证场景定义
    public function sceneDelete()
    {
        return $this->append('param.filter', 'require');
    }

    // SelectEpisodeWithAllocation 验证场景定义
    public function sceneSelectEpisodeWithAllocation()
    {
        return $this->append("param", "require|array")
            ->append("param.filter.project_id", "require|integer")
            ->append("param.page", "array");
    }

    // AllocationEpisode 验证场景定义
    public function sceneAllocationEpisode()
    {
        return $this->append("data", "require|array")
            ->append("data.role_code", "require")
            ->append("data.entity_ids", "require")
            ->append("data.project_id", "require|integer")
            ->append("data.id", "require|integer");
    }

    // SelectByUser 验证场景定义
    public function sceneSelectByUser()
    {
        return $this->append('param.filter.project_id', 'require');
    }

    // SelectCurrentUserByRoleCode 验证场景定义
    public function sceneSelectCurrentUserByRoleCode()
    {
        return $this->append('param.filter.project_id', 'require|integer');
    }

    // SelectEpisodeScheduleByProject 验证场景定义
    public function sceneSelectEpisodeScheduleByProject()
    {
        return $this->append('param.filter.project_id', 'require|integer');
    }
}
